package Gather.CollectionLearn.Collection集合;

import java.util.ArrayList;
import java.util.Collection;

public class IsEmptyListedAs {
    public static void main(String[] args) {
        //创建集合对象
        Collection<Student> coll=new ArrayList<>();

        //创建三个学生对象
        Student stu1=new Student("zhangsan",12);
        Student stu2=new Student("lisi",12);
        Student stu3=new Student("wangwu",12);


        //添加到集合
        coll.add(stu1);
        coll.add(stu2);
        coll.add(stu3);

        //判断集合是否存在该元素
        Student stu=new Student("zhangsan",12);
        //输出结果
        System.out.println(coll.contains(stu));
    }
}
